***************************************************************
* Replication file for                                        *
* "Altruism and Spite in Politics:                            *
* How the Mind Makes Tradeoffs About Political Parties"       *
* by Alessandro Del Ponte, Andrew W. Delton, & Peter DeScioli *
***************************************************************

*******************
*******************
* Study 1 - MTurk *
*******************
*******************
//use Mturk_Replication.dta file

*************
* Main Text *
*************
//Cronbach's alphas

*Inparty enthusiasm
alpha inpride inenth ingrate

*Outparty enthusiasm
alpha outpride outenth outgrate


//Consistency
* inparty
sum inwtrconsistency

*outparty
sum outwtrconsistency

//Average WTRs
*In-party altruism
sum inwtr

*Out-party spite
sum outwtr


*****************************************
* Figure 1 - WTRs for political parties * 
*****************************************
//Panel A - inparty altruism
tab inwtr

//Panel B - Outparty spite
tab outwtr

****************************************************************************
* Table 1 - Correlations between WTRs and partisanship, ideology, emotions *
****************************************************************************
//inparty altruism
pwcorr inwtr pstrength, sig
pwcorr inwtr ideo_folded, sig
pwcorr inwtr inPosEmotions, sig
pwcorr inwtr inanger, sig

//outparty spite
pwcorr outwtr pstrength, sig
pwcorr outwtr ideo_folded, sig
pwcorr outwtr outPosEmotions, sig
pwcorr outwtr outangry, sig


************
* Appendix *
************

*****************************************************
* Table A1 -  Correlations between WTRs and anxiety *
*****************************************************
pwcorr inwtr inworried, sig
pwcorr outwtr outworried, sig


*************************************
* Table A3 - Descriptive Statistics *
*************************************
sum age
sum pstrength
sum ideo_folded
sum educ
sum income
sum satis
sum care

tab gender
tab white
tab pid
tab republican
tab job
tab care


*********************************************************************
* Table A4 - WTRs toward inparty and outparty regressed on emotions *
*********************************************************************
*(1) Inparty altruism
reg inwtr inPosEmotions inanger inworried, robust

*(2) Outparty spite
reg outwtr outPosEmotions outangry outworried, robust


*************************************************************************
* Table A5 - WTRs toward inparty and outparty regressed on partisanship *
*************************************************************************
*(1) Inparty altruism
reg inwtr pstrength ideo_folded, robust

*(2) Outparty spite
reg outwtr pstrength ideo_folded, robust


*****************************************************************************
* Table A6 - Profile of the most altruistic participants toward the inparty *
*****************************************************************************
//partisanship
sum pstrength if inwtr <=1
sum pstrength if inwtr > 1
sum pstrength if inwtr >0
sum pstrength if inwtr == 0

//ideology
sum ideo_folded if inwtr <=1
sum ideo_folded if inwtr > 1
sum ideo_folded if inwtr >0
sum ideo_folded if inwtr == 0

//enthusiasm
sum inPosEmotions if inwtr <=1
sum inPosEmotions if inwtr > 1
sum inPosEmotions if inwtr >0
sum inPosEmotions if inwtr == 0

//anxiety
sum inworried if inwtr <=1
sum inworried if inwtr > 1
sum inworried if inwtr >0
sum inworried if inwtr == 0

//anger
sum inanger if inwtr <=1
sum inanger if inwtr > 1
sum inanger if inwtr >0
sum inanger if inwtr == 0


******************************************************************************
* Table A7 - Profile of the most altruistic participants toward the outparty *
******************************************************************************
//partisanship
sum pstrength if outwtr >= -1
sum pstrength if outwtr < -1
sum pstrength if outwtr <0
sum pstrength if outwtr == 0

//ideology
sum ideo_folded if outwtr >= -1
sum ideo_folded if outwtr < -1
sum ideo_folded if outwtr <0
sum ideo_folded if outwtr == 0

//enthusiasm
sum outPosEmotions if outwtr >= -1
sum outPosEmotions if outwtr < -1
sum outPosEmotions if outwtr <0
sum outPosEmotions if outwtr == 0

//anxiety
sum outworried if outwtr >= -1
sum outworried if outwtr < -1
sum outworried if outwtr <0
sum outworried if outwtr == 0

//anger
sum outangry if outwtr >= -1
sum outangry if outwtr < -1
sum outangry if outwtr <0
sum outangry if outwtr == 0



*****************
*****************
* Study 2 - Lab *
*****************
*****************
//use lab_Replication.dta file

*************
* Main Text *
*************

//Consistency - altruism
*inparty altruism
sum inwtrconsistency_task1

*outparty altruism
sum outwtrconsistency_task1

//Consistency, excluding those who always or never helped the party
*inparty altruism
sum inwtrconsistency_task1 if totintask1 != 0 & totintask1 != 1

*outparty altruism
sum outwtrconsistency_task1 if totouttask1 != 0 & totouttask1 != 1


//Consistency - spite
*inparty spite
sum inwtrconsistency_task2 

*outparty spite
sum outwtrconsistency_task2

//Consistency, excluding those who always or never spited the party
*inparty spite
sum inwtrconsistency_task2 if totintask2 != 0 & totintask2 != 1

*outparty spite
sum outwtrconsistency_task2 if totouttask2 != 0 & totouttask2 != 1


*********************************
* Table 2 - WTRs toward parties *
*********************************
//Altruism
*inparty altruism
sum inwtr_task1

*outparty altruism
sum outwtr_task1

//test whether WTR_inparty > WTR_outparty
ttest inwtr_task1 = outwtr_task1

//Spite
*inparty spite
sum inwtr_task2

*outparty spite
sum outwtr_task2

//test whether WTR_inparty > WTR_outparty
ttest inwtr_task2 = outwtr_task2


************************************************
* Figure 2 - Altruism and spite toward parties *
************************************************
// Panel A - inparty altruism
sum inwtr_task1

//Panel B - outparty altruism
sum outwtr_task1

//Panel C - inparty spite
sum inwtr_task2

//Panel D - outparty spite
sum outwtr_task2

****************************************************************************
* Table 3 - Correlations between WTRs and partisanship, ideology, emotions *
****************************************************************************
//Inparty WTRs
*(1) Altruism
pwcorr inwtr_task1 hstrength, sig
pwcorr inwtr_task1 ideo_folded, sig
pwcorr inwtr_task1 inenthusiasm, sig
pwcorr inwtr_task1 inanger, sig

*(2) Spite
pwcorr inwtr_task2 hstrength, sig
pwcorr inwtr_task2 ideo_folded, sig
pwcorr inwtr_task2 inenthusiasm, sig
pwcorr inwtr_task2 inanger, sig

*(3) Altruism
pwcorr outwtr_task1 hstrength, sig
pwcorr outwtr_task1 ideo_folded, sig
pwcorr outwtr_task1 outenthusiasm, sig
pwcorr outwtr_task1 outanger, sig

*(4) Spite
pwcorr outwtr_task2 hstrength, sig
pwcorr outwtr_task2 ideo_folded, sig
pwcorr outwtr_task2 outenthusiasm, sig
pwcorr outwtr_task2 outanger, sig


************
* Appendix *
************

//Cronbach's alphas

*Inparty enthusiasm
alpha inenth ingrate inpride

*Outparty enthusiasm
alpha outenth outgrate outpride

*Political participation
alpha fk1 fk2 fk3 fk4 fk5 fk5 fk6 fk7

*Political interest
alpha inter1 inter2

*Huddy et al.'s (2015) partisan identity scale
alpha pidh1 pidh2 pidh3 pidh4


****************************************
* Table A9 - Correlations between WTRs *
****************************************
pwcorr inwtr_task1 inwtr_task2, sig
pwcorr inwtr_task1 outwtr_task1, sig
pwcorr inwtr_task1 outwtr_task2, sig
pwcorr inwtr_task2 outwtr_task1, sig
pwcorr inwtr_task2 outwtr_task2, sig
pwcorr outwtr_task1 outwtr_task2, sig


***********************************************
* Table A10 - Regressions of WTRs on emotions *
***********************************************
*(1) Inparty altruism
reg inwtr_task1 inenthusiasm inanger inworry, robust

*(2) Inparty spite
reg inwtr_task2 inenthusiasm inanger inworry, robust

*(3) Outparty altruism
reg outwtr_task1 outenthusiasm outanger outworry, robust

*(4) Outparty spite
reg outwtr_task2 outenthusiasm outanger outworry, robust


****************************************************************
* Table A11 - Regressions of WTRs on partisanship and ideology *
****************************************************************
*(1) Inparty altruism
reg inwtr_task1 hstrength ideo_folded, robust

*(2) Inparty spite
reg inwtr_task2 hstrength ideo_folded, robust

*(3) Outparty altruism
reg outwtr_task1 hstrength ideo_folded, robust

*(4) Outparty spite
reg outwtr_task2 hstrength ideo_folded, robust


********************************
* Table A12 - Anxiety and WTRs *
********************************
*(1) Inparty altruism
pwcorr inwtr_task1 inworry, sig

*(2) Inparty spite
pwcorr inwtr_task2 inworry, sig

*(3) Outparty altruism
pwcorr outwtr_task1 outworry, sig

*(4) Outparty spite
pwcorr outwtr_task2 outworry, sig


******************************************************************************
* Table A13 - Profile of the most altruistic participants toward the inparty *
******************************************************************************
//Partisan identity
sum hstrength if inwtr_task1 <= 1
sum hstrength if inwtr_task1 > 1
sum hstrength if inwtr_task1 > 0
sum hstrength if inwtr_task1 == 0

//Ideology (folded)
sum ideo_folded if inwtr_task1 <= 1
sum ideo_folded if inwtr_task1 > 1
sum ideo_folded if inwtr_task1 > 0
sum ideo_folded if inwtr_task1 == 0

//Enthusiasm
sum inenthusiasm if inwtr_task1 <= 1
sum inenthusiasm if inwtr_task1 > 1
sum inenthusiasm if inwtr_task1 > 0
sum inenthusiasm if inwtr_task1 == 0

//Anxiety
sum inworry if inwtr_task1 <= 1
sum inworry if inwtr_task1 > 1
sum inworry if inwtr_task1 > 0
sum inworry if inwtr_task1 == 0

//Anger
sum inanger if inwtr_task1 <= 1
sum inanger if inwtr_task1 > 1
sum inanger if inwtr_task1 > 0
sum inanger if inwtr_task1 == 0


****************************************************************************
* Table A14 - Profile of the most spiteful participants toward the inparty *
****************************************************************************
//Partisan identity
sum hstrength if inwtr_task2 >= -1
sum hstrength if inwtr_task2 < -1
sum hstrength if inwtr_task2 < 0
sum hstrength if inwtr_task2 == 0

//Ideology (folded)
sum ideo_folded if inwtr_task2 >= -1
sum ideo_folded if inwtr_task2 < -1
sum ideo_folded if inwtr_task2 < 0
sum ideo_folded if inwtr_task2 == 0

//Enthusiasm
sum inenthusiasm if inwtr_task2 >= -1
sum inenthusiasm if inwtr_task2 < -1
sum inenthusiasm if inwtr_task2 < 0
sum inenthusiasm if inwtr_task2 == 0

//Anxiety
sum inworry if inwtr_task2 >= -1
sum inworry if inwtr_task2 < -1
sum inworry if inwtr_task2 < 0
sum inworry if inwtr_task2 == 0

//Anger
sum inanger if inwtr_task2 >= -1
sum inanger if inwtr_task2 < -1
sum inanger if inwtr_task2 < 0
sum inanger if inwtr_task2 == 0


*******************************************************************************
* Table A15 - Profile of the most altruistic participants toward the outparty *
*******************************************************************************
//Partisan identity
sum hstrength if outwtr_task1 <= 1
sum hstrength if outwtr_task1 > 1
sum hstrength if outwtr_task1 > 0
sum hstrength if outwtr_task1 == 0

//Ideology (folded)
sum ideo_folded if outwtr_task1 <= 1
sum ideo_folded if outwtr_task1 > 1
sum ideo_folded if outwtr_task1 > 0
sum ideo_folded if outwtr_task1 == 0

//Enthusiasm
sum outenthusiasm if outwtr_task1 <= 1
sum outenthusiasm if outwtr_task1 > 1
sum outenthusiasm if outwtr_task1 > 0
sum outenthusiasm if outwtr_task1 == 0

//Anxiety
sum outworry if outwtr_task1 <= 1
sum outworry if outwtr_task1 > 1
sum outworry if outwtr_task1 > 0
sum outworry if outwtr_task1 == 0

//Anger
sum outanger if outwtr_task1 <= 1
sum outanger if outwtr_task1 > 1
sum outanger if outwtr_task1 > 0
sum outanger if outwtr_task1 == 0


*****************************************************************************
* Table A16 - Profile of the most spiteful participants toward the outparty *
*****************************************************************************
//Partisan identity
sum hstrength if outwtr_task2 >= -1
sum hstrength if outwtr_task2 < -1
sum hstrength if outwtr_task2 < 0
sum hstrength if outwtr_task2 == 0

//Ideology (folded)
sum ideo_folded if outwtr_task2 >= -1
sum ideo_folded if outwtr_task2 < -1
sum ideo_folded if outwtr_task2 <0
sum ideo_folded if outwtr_task2 == 0

//Enthusiasm
sum outenthusiasm if outwtr_task2 >= -1
sum outenthusiasm if outwtr_task2 < -1
sum outenthusiasm if outwtr_task2 <0
sum outenthusiasm if outwtr_task2 == 0

//Anxiety
sum outworry if outwtr_task2 >= -1
sum outworry if outwtr_task2 < -1
sum outworry if outwtr_task2 <0
sum outworry if outwtr_task2 == 0

//Anger
sum outanger if outwtr_task2 >= -1
sum outanger if outwtr_task2 < -1
sum outanger if outwtr_task2 <0
sum outanger if outwtr_task2 == 0


***************************************
* Table A17 - WTRs by leaner/partisan *
***************************************
sort leaners
by leaners: sum inwtr_task1
by leaners: sum inwtr_task2
by leaners: sum outwtr_task1
by leaners: sum outwtr_task2

*********************************************
* other analyses referenced in the appendix *
*********************************************
//Political interest
sort HighPolInt
by HighPolInt: sum inwtr_task1
by HighPolInt: sum inwtr_task2
by HighPolInt: sum outwtr_task1
by HighPolInt: sum outwtr_task2

//Political participation
sort highPart 
by highPart: sum inwtr_task1
by highPart: sum inwtr_task2
by highPart: sum outwtr_task1
by highPart: sum outwtr_task2


******************************************
* Table A18 - WTRs by low/high knowledge *
******************************************
sort highK
by highK: sum inwtr_task1
by highK: sum inwtr_task2
by highK: sum outwtr_task1
by highK: sum outwtr_task2


*****************************************
* Table A19 - WTRs by outparty emotions *
*****************************************
//enthusiasm
sort highEnthO
by highEnthO: sum outwtr_task1
by highEnthO: sum outwtr_task2

//anxiety
sort highAnxietyO
by highAnxietyO: sum outwtr_task1
by highAnxietyO: sum outwtr_task2

//anger
sort highOutAnger 
by highOutAnger : sum outwtr_task1
by highOutAnger : sum outwtr_task2


****************************************
* Table A20 - WTRs by inparty emotions *
****************************************
//enthusiasm
sort highEnthI
by highEnthI: sum inwtr_task1
by highEnthI: sum inwtr_task2

//anxiety
sort highAnxietyI
by highAnxietyI: sum inwtr_task1
by highAnxietyI: sum inwtr_task2

//anger
sort highInAnger
by highInAnger: sum inwtr_task1
by highInAnger: sum inwtr_task2


*************************************************
* Table A21 - WTRs by partisanship and ideology *
*************************************************
//Partisanship
sort highPID
by highPID: sum inwtr_task1
by highPID: sum inwtr_task2
by highPID: sum outwtr_task1
by highPID: sum outwtr_task2

//Ideology
sort ExtremeIdeo
by ExtremeIdeo: sum inwtr_task1
by ExtremeIdeo: sum inwtr_task2
by ExtremeIdeo: sum outwtr_task1
by ExtremeIdeo: sum outwtr_task2

********************************************************
* Figure A1 - Spite, ideology, and political knowledge *
********************************************************
//Panel A
interflex inwtr_task2 ideo_folded knowledge, vce(robust) title("In-Party")

//Panel B
interflex outwtr_task2 ideo_folded knowledge, vce(robust) title("Out-Party")
